package ru.rchervot.sanasar.client.event;

import com.google.gwt.event.shared.GwtEvent;

public class EventSelectedNone extends GwtEvent<HandlerSelectedNone> {
	private static Type<HandlerSelectedNone> TYPE = new Type<HandlerSelectedNone>();
	
	private final String queryDescription;
	private final int resultsSize;
	
	private EventSelectedNone() {
		queryDescription = "";
		resultsSize = 0;
	} //TODO why not remove ?
	
	private EventSelectedNone(String queryDescription, int resultsSize) {
		this.queryDescription = queryDescription;
		this.resultsSize = resultsSize;
	}
	
	@Override
	protected void dispatch(HandlerSelectedNone handler) {
		handler.onAction(this);
	}

	/**
	 * Gets the type associated with this event.
	 * 
	 * @return returns the handler type
	 */
	public static Type<HandlerSelectedNone> getType() {
		if (TYPE == null) {
			TYPE = new Type<HandlerSelectedNone>();
		}
		return TYPE;
	}

	@Override
	public Type<HandlerSelectedNone> getAssociatedType() {
		return TYPE;
	}

	public String getQueryDescription() {
		return queryDescription;
	}

	public int getResultsSize() {
		return resultsSize;
	}

	public static EventSelectedNone build(String queryDescription, int resultsSize) {
		return new EventSelectedNone(queryDescription, resultsSize);
	}

}
